<div class="container_ personalCenter">
    <!-- 用户信息 -->
    <div class="userInfo">
        <div class="user">
            <div class="nameAndTouxiang">
                <img src="{{asset('images/500406908_banner@2x.png')}}" alt="">
                <div>
                    <p class="userName">{{$user->name}}</p>
                    @if($chest->isUser())
                        <p>个人租赁</p>
                    @elseif($chest->isCompany())
                        <p>公司租赁</p>
                    @elseif($chest->isBuyer())
                        <p>公司采购</p>
                    @else
                        <p>时租电柜</p>
                    @endif

                </div>
            </div>
            <a class="signOut" href="{{ route('logout') }}"
               onclick="event.preventDefault();
                           document.getElementById('logout-form').submit();">
                退出登录
            </a>

            <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                {{ csrf_field() }}
            </form>
        </div>
    </div>

    <!-- 我的设备 -->
    <div class="myDevice">
        <div class="myDeviceTitle">我的设备</div>
        <div class="list">
            {{-- <a id="scan">
                 <img src="{{asset('icon/shaoyishao(1)@2x.png')}}" alt="">
                 <p>扫码开柜</p>
             </a>--}}
            <a href="{{route('scan.index')}}">
                <img src="{{asset('icon/shaoyishao(1)@2x.png')}}" alt="">
                <p>测试扫码</p>
            </a>
            @if($groups && $chest->isUser() ||  $chest->isCompany())
                @if( $chest->isUser())
                    <a href="{{route('user.device')}}">
                        <img src="{{asset('icon/shebei@2x.png')}}" alt="">
                        <p>我的设备</p>
                    </a>
                    <a href="{{route('user.order')}}">
                        <img src="{{asset('icon/dingdanguanli@2x.png')}}" alt="">
                        <p>订单管理</p>
                    </a>
                @endif
                <a href="{{route('user.member')}}">
                    <img src="{{asset('icon/renyuan@2x.png')}}" alt="">
                    <p>成员管理</p>
                </a>

            @endif

            @if($chest->isTime() || $chest->isCompany())
                <a href="{{route('device.repairForm')}}">
                    <img src="{{asset('icon/baoxiu@2x.png')}}" alt="">
                    <p>设备报修</p>
                </a>
            @endif
            <a href="{{route('user.record')}}">
                <img src="{{asset('icon/shiyongjilu@2x.png')}}" alt="">
                <p>使用记录</p>
            </a>

            <div class="kongItem"></div>
            <div class="kongItem"></div>
            <div class="kongItem"></div>
            <div class="kongItem"></div>
            <div class="kongItem"></div>
        </div>
    </div>

    <div style="height: 10px;background-color: #ececec;margin-top: 30px;"></div>

    <!-- 系统设置 -->
    <div class="myDevice">
        <div class="myDeviceTitle">系统设置</div>
        <div class="list">
            <a href="{{route('about.index')}}">
                <img src="{{asset('icon/guanyuwomen@2x.png')}}" alt="">
                <p>关于我们</p>
            </a>
            <div class="kongItem"></div>
        </div>
    </div>
</div>

@if(isWechatBrowser())
    @php
        $jsSDK = new \App\Service\JsSDK();
        $signPackage = $jsSDK->GetSignPackage();
    @endphp
    @push('js')
        <script>
            wx.config({
                @if(config('app.debug'))
                debug: true,
                @endif
                appId: '<?php echo $signPackage["appId"];?>',
                timestamp: <?php echo $signPackage["timestamp"];?>,
                nonceStr: '<?php echo $signPackage["nonceStr"];?>',
                signature: '<?php echo $signPackage["signature"];?>',
                jsApiList: [
                    'scanQRCode'
                ]
            });
            wx.ready(function () {
                $("#scan").on('click', function () {
                    wx.scanQRCode({
                        needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
                        scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码，默认二者都有
                        success: function (res) {
                            var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                            alert('result');
                        }
                    });
                })

            });
        </script>
    @endpush

@endif
